CREATE TABLE IF NOT EXISTS message (
    id SERIAL PRIMARY KEY,
    content TEXT,
    user_id INTEGER REFERENCES "User" (id),
    timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    is_ai BOOLEAN,
    mode VARCHAR(50)
);

-- Создание таблицы "Feedback"
CREATE TABLE IF NOT EXISTS feedback (
    id SERIAL PRIMARY KEY,
    message_id INTEGER REFERENCES Message (id),
    user_id INTEGER REFERENCES "User" (id),
    comment TEXT,
    timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    mark INTEGER
);

-- Создание таблицы "Report"
CREATE TABLE IF NOT EXISTS report (
    id SERIAL PRIMARY KEY,
    user_id INTEGER REFERENCES "User" (id),
    action TEXT,
    timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    file BYTEA
);

CREATE TABLE IF NOT EXISTS users (
    id SERIAL PRIMARY KEY,
    username VARCHAR(50) UNIQUE,
    password_hash VARCHAR(128),
    email VARCHAR(100) UNIQUE
);
